export function filterCpasTable(dsSourceData, newTableCfg) {
    console.log(dsSourceData, "dsSourceData111");
    const sourceData = dsSourceData.data ? dsSourceData.data : [];
    const { filterCfg = {} } = newTableCfg || {};
    const { selectColumnNum, order, num } = filterCfg;
    let newData = sourceData.slice(1);
    const firstRowData = sourceData.slice(0, 1);
    if (Object.keys(filterCfg).length < 1 || !newData.length) {
        return dsSourceData;
    }
    console.log(selectColumnNum, "selectColumnNum1111");
    if (selectColumnNum) {
        newData.sort((x, y) => {
            return y[selectColumnNum] - x[selectColumnNum];
        });
    }
    console.log(newData, "newData1111");
    if (order === "front" && num) {
        newData = newData.slice(0, num);
    }
    if (order === "after" && num) {
        newData = newData.slice(num);
    }
    console.log(newData, "newData2222");
    return {
        ...dsSourceData,
        data: [...firstRowData, ...newData],
    };
}
